
//** I N C L U D E S **********************************************************/
#include <p24fj16ga002.h>
#include "Config.h"
#include "1wire.h"
#include "uart.h"
#include <osa.h>
#include <binsem.h>
//#include "my_osa_init.h"

//******* G E N E R I C   D E F I N I T I O N S ************************************************/
//#define BAUD_CONTROL			00

//********OSA PROTOTIPE
void task_temp (void);
void task_governor (void);
void task_console (void);
void task_uart (void);
void task_1wire (void);
void RS_Drv (void);

//*************************************************************************

//****** P R O T O T Y P E S ******************************************************/
void PutString (unsigned char *mess);
unsigned char Getchar(void);
void Putchar (unsigned char);
unsigned char Detect_Slave_Device(void);
void hex_ascii(unsigned char);


_CONFIG2( IESO_OFF & FNOSC_PRIPLL & FCKSM_CSDCMD & OSCIOFNC_ON & POSCMOD_HS & I2C1SEL_PRI)
_CONFIG1( JTAGEN_OFF & GCP_OFF & GWRP_OFF & COE_OFF & ICS_PGx1 & FWDTEN_OFF & WINDIS_OFF);


//Global variable
OST_PMSG    pmsg;
OST_PMSG	p_tmsg;

int main(void)
{

	init();
    OS_Init();
    my_osa_init();
    
    OS_CreateTask(4,RS_Drv);
    OS_CreateTask(4,task_governor);
    OS_CreateTask(4,task_temp);
    OS_CreateTask(4,task_uart);
    
    //OS_Run();
    
    
    for (;;) {
        OS_Sched ();
    }



	

		
   
   
   
   
} // END OF MAIN

/**********************************************************************
* Function:        unsigned char Detect_Slave_Device(void)
* PreCondition:    None
* Input:		   None	
* Output:		   1 - Not Present   0 - Present 	
* Overview:   	   To check the presence of slave device.    
***********************************************************************/

unsigned char Detect_Slave_Device(void)
{
	if (!OW_reset_pulse())
		return HIGH;
	else 		
		return LOW;
}	




